<template>
  <div class="bg-white rounded-lg p-5 h-full flex flex-col">
    <div class="font-bold text-xl mb-4">{{ doctor.enterpriseName }}</div>
    <div class="mb-4">
      <dict-tag :options="dict.type.medical_org_type" :value="doctor.orgType" />
    </div>
    <div class="">
      <el-descriptions :column="2" border>
        <el-descriptions-item label="医师名称">
          {{ doctor.physicianName }}
        </el-descriptions-item>
        <el-descriptions-item label="医师执业编号">
          {{ doctor.certificateNumber }}
        </el-descriptions-item>
        <el-descriptions-item label="医师执业类别">
          {{ doctor.physicianType }}
        </el-descriptions-item>
        <el-descriptions-item label="医师执业范围">
          {{ doctor.practicingRange }}
        </el-descriptions-item>
        <el-descriptions-item label="处方权限授权">
          {{ doctor.authInfo }}
        </el-descriptions-item>
        <el-descriptions-item label="异常内容">
          {{ doctor.prescriptionContent }}
        </el-descriptions-item>
      </el-descriptions>
      <div class="font-bold my-4">开药记录</div>

      <el-table :data="dataList" border>
        <el-table-column prop="drugName" label="药品名称"> </el-table-column>

        <el-table-column prop="drugType" label="药品类型">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.drug_type"
              :value="scope.row.drugType"
            />
          </template>
        </el-table-column>
        <el-table-column prop="abnormalStatus" label="是否异常">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.yes_or_no"
              :value="scope.row.abnormalStatus"
            />
          </template>
        </el-table-column>
        <!-- <el-table-column label="操作" align="center" width="100">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="toMaterialPage(scope.row)"
              >查看详情</el-button
            >
          </template>
        </el-table-column> -->
      </el-table>
    </div>
    <hr class="my-4" />
    <div class="">
      <el-button type="primary" @click="goBack">返回</el-button>
    </div>
  </div>
</template>

<script>
import { getPrescribeDetailAPI } from "@/api/zhangping/health-care/doctor-prescribe";
export default {
  dicts: [
    "waste_manage_status",
    "waste_manage_type",
    "yes_or_no",
    "drug_type",
    "medical_org_type",
  ],
  data() {
    return {
      queryForm: {
        pageNum: 1,
        pageSize: 10,
        abnormalPrescriptionId: null,
      },
      loading: false,
      hospitalInfo: {},
      dataList: [],
    };
  },
  computed: {
    doctor: function () {
      return this.$store.state.hospital.doctor;
    },
  },
  mounted() {
    this.getDataList();
  },
  methods: {
    toMaterialPage() {
      const obj = {
        path: "/health-care/doctor-prescribe-material",
        query: {
          id: this.$route.query.id,
        },
      };
      this.$router.push(obj);
    },
    reset() {
      this.$refs["queryForm"].resetFields();
      this.queryForm.dateRange = null;
      this.search();
    },
    search() {
      this.queryForm.pageNum = 1;
      this.getDataList();
    },
    goBack() {
      this.$router.back();
    },
    getDataList() {
      this.loading = true;
      const id = this.$route.query.id;
      this.queryForm.abnormalPrescriptionId = id;

      getPrescribeDetailAPI(this.queryForm)
        .then((response) => {
          this.dataList = response.rows;
          this.total = response.total;
        })
        .finally(() => {
          this.loading = false;
        });
    },
  },
};
</script>

<style lang="scss" scoped></style>
